/**
 * 
 */
package t4j.strings;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author sz
 *
 * create time：2012-11-29
 */
public class ReFlags {

	public static void main(String[] args) {
		
		/*
		 * Pattern.CASE_INSENSITIVE 忽略大小写
		 * Pattern.MULTILINE 在设置了多行标记的状态下，
		 * 对每一个行(从字符序列的第一个字符开始，至每一个行终结符，例如\n）都进行匹配
		 */
		Pattern p = Pattern.compile("^Java", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
		
		
		  Matcher m = p.matcher(
			      "java has regex\nJava has regex\n" +
			      "JAVA has pretty good regular expressions\n" +
			      "Regular expressions are in Java");
		  
		  while(m.find())
			  System.out.println(m.group());
	}
}
